<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="../base.jsp" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
</head>
<body>
<div id="frameContent" class="content-wrapper" style="margin-left:0px;">
    <section class="content-header">
        <h1>
            统计分析
            <small>登录ip次数排行统计</small>
        </h1>
    </section>
    <section class="content">
        <div class="box box-primary">
            <div id="main" style="width: 100%;height:400px;"></div>
        </div>
    </section>
</div>
</body>
<script src="../plugins/jQuery/jquery-2.2.3.min.js"></script>
<script src="../../plugins/echarts/echarts.min.js"></script>
<script type="text/javascript">

    $.get("/stat/getLoginData.do", function (LoginData) {

        var name = [];
        var value = [];

        for (var i = 0; i < LoginData.length; i++) {
            name[i] = LoginData[i].name;
            value[i] = LoginData[i].value;
        }


        // 基于准备好的dom，初始化echarts实例
        var myChart = echarts.init(document.getElementById('main'));

        // 指定图表的配置项和数据
        var option = {
            xAxis: {
                type: 'category',
                data: name,
                axisLabel: {
                    rotate: 70
                }
            },
            yAxis: {
                type: 'value'
            },
            series: [{
                data: value,
                type: 'bar',
                barWidth: 30,
                label: {
                    show: true,//开启显示
                    position: 'top', //在上方显示
                    textStyle: {
                        color: 'black',
                        fontSize: 16,
                        fontWeight: 600
                    }
                }
            }]
        };

        // 使用刚指定的配置项和数据显示图表。
        myChart.setOption(option);
    });
</script>
</html>